{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import math\n",
    "import pylab as pl\n",
    "import scipy.signal as signal\n",
    "import matplotlib.pyplot as plt\n",
    " \n",
    "sampling_rate=1000\n",
    "t1=np.arange(0, 10.0, 1.0/sampling_rate)\n",
    "x1 =np.sin(200*np.pi*t1)+0.2*np.sin(400*np.pi*t1)\n",
    " \n",
    "# 傅里叶变换\n",
    "def fft1(xx):\n",
    "#   t=np.arange(0, s)\n",
    "    t=np.linspace(0, 1.0, len(xx))\n",
    "    f = np.arange(len(xx)/2+1, dtype=complex)\n",
    "    for index in range(len(f)):\n",
    "        f[index]=complex(np.sum(np.cos(2*np.pi*index*t)*xx), -np.sum(np.sin(2*np.pi*index*t)*xx))\n",
    "    return f\n",
    " \n",
    "# len(x1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAA7QAAAEWCAYAAABWjNtiAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAAAsTAAALEwEAmpwYAAAt8UlEQVR4nO3deZhcdZXw8e9JyAZJCIEAIQuBEDaFoIQdR5RVB4FB2VFUEBVR8B0XEDdeQZ1n1FE0igwyAoqKCxoU2RTEBYSA7IvmZUsAZd8CAgnn/ePemqp0V5JuUl031fX9PM99bt177nKq+tdVffr3q3sjM5EkSZIkqdMMqToBSZIkSZJeCQtaSZIkSVJHsqCVJEmSJHUkC1pJkiRJUkeyoJUkSZIkdSQLWkmSJElSR7KglSQNShGxS0QsaFi+LSJ2aeHx742I3Vp1PEmS1H8WtJKktouIKyPiiYgY0a5zZuarMvPK8vyfjYjvtevcPZXP/58R8WzDtENV+UiS1KksaCVJbRUR04DXAQnsU202lTo2M0c3TFc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PzzRfyTn8xcb71imjixmKZMqT//44/PXHfdYlpnnWLaZJN6/MgjM9deu5gmTCimrbaqxw84IHPNNZecdtyxHt9rr8w11lhy2n33enzHHTNXX33Jad996/EttsgcM2bJ6dBD6/H1189cbbXMVVetT0ceWY+vsUbmqFGZI0fWp+OOK2Ivvpg5YkQxDR9enz7xiSL+2GOZw4YV0yqr1KfPf76I33NPZlFWLjmddloRv/nm5vHvfKeI//3vxbGefrqe70svZc6bVzxevLjIp+f+731vEV+0qPnxP/rRIv7EE/V1EZlDhmQOHZp5yilFfP78+msyalTx2q22WuY3vlHE77wzc9y4+s9t/Pji53vuuUX8+uvrbaNx+vnPi/hVV9XbVuN0+eVF/Ne/rrfJxumaa4r4j39cb7uN0623FvGzz663/cbp3nuL+De/WbT1ntMjjxTx//zP5r9bzz1XxE8+uffv5fTp9Z/Vxz6WucEGS04zZ9bjxx7b+/d+p53q8SOP7P2+seee9fjBB2fOmLHk9La31eN77VU8n0mTitdtnXUy3/rWenzmzOL3ZbXVip/viBFL7r/WWku2myFDiveDzOI1GDeud9s64ID6/musUfxuDB9eHHvkyMz3v78eHzu2OP/YscXv9bhx9d+tZ58t3kvWXrv+vrPuusX7WWbmP/7RvO3Mnl3E7767eds5++wifsstzdvOT39axK++esn3y9p08cVF/PLLm7etP/yhiP/8583jN95YxM87r3nb+9vfivh//3fztvfgg0X8q18t3tt6Tk89VcRPPbX558bixUX8pJN6t83NN6//bI4/vr6+1ja33bYeP/ro3m33DW+oxw89tHd8773r8X337R0/6KB6fLfdesff/e56fIcdesc/+MF6fMste8dPPLEenz69d/xznytiCxc2/0z+yleK+MMPN49/+9tF/J57mse///0ifuutzeO198U//7l5/NJLi/hvf1vk33P605+K+IUXNo/fdFMR/+EPm8drnyvf+U7z+EMPFfHTTmser31OfeELzeO1tvfJT/aOvfrV9Z/Nhz/cO77ddku2vZ7xN76xHj/ssN7xt7ylHt9vv97xgw+ux3ffvXe88W+GHXfsHf/Qh+rxmTN7xxvb3kYb9Y7XPnMXLmz+9+J//Ve97TWLn3FGve01i593XhG/7bbm8V/8ot72msUvu6ze9prFG9tes3hj22sWr7W9s85qHq+1va9/vXm81va++MXm8ca21zO2xRZLtr2e8e23r8ff+97e8V13rccPP7x3fJ996vH99+/9mX3IIfX4nnv2jh91VD2+006947W/VzPr7yErMWBuLqUebGc3yyRgfsPyAnr3vjbbZhLwUONGEXE0cDTA1KlTW55oS40aBa9+dX05opivvnoxHzsWXttkZHUtvsYasO22veOjRxfztdaCHXfsHa9dfGXiRPiXf+kdHzmymK+/Przxjb3jw4YV8402gj326J3/0KHFfPPN4c1vXjI+pGEk+1ZbwXPPLRmv5QbFc6udqxZfY4368utfD2uvvWRu665bf7zHHsXVexutv3798T77wDbbLBnfeOP64wMPhMcfXzK+xRb1x0ccAQsX1nMD2Hrrevy9763fgqQW32GHYj5kCBx//JLPDeB1ryvmI0fCRz7SO7799sV8/Hg45ZSiN3TYsHoPaW3/qVPhvPOKdaNHF6/bGmvApElFfJ114MQTl3xuq6wC06fX83v00aL37Omni17eZ5+FyZPr259+er13ePHiYl57PUeMgE9/unfJW2uPo0fXe4Ib47XXd/XV4e1v7x3fcMP6899/f3qp5bfWWsXPt6dae1lnHdh7797x8eOL+aRJS7bdmjFj6udpbPs1tSv1TpsGu+3WOz58eDHfcMPmv1u134/p03v/btbaABTteuedm58binb85JNLxmvPrRZ//vkl4+utV3+86aZLnq+Wc8022xTvH0OG1KdNN63H3/a24nenMf6qV9Xjn/xk0W7HjYMJE4r3uTXXrD+Pe+6BW28tLhD12GNFrrW2CfDhDxfvHY1to/G98Kij4OWXl4zXfjeHDi2G2deG1tfmtfxHjGjedmrnX3XV5m2n9t4ydmzztlN7fcePh7326h2vtc0JE5q3rdrPb+LE5vGxY+vnadb2ar3bU6Y0b3u19/1p02CXXXrHayMvNtyw+edGzfTpvdtmrd1D0fZ23nnJrzbUPtOg+Dk0fi5A8fta8+pXL/k5Aku+r2+5Zf33tGaTTeqPX/OaJT8nADbbrP541qzeV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mSJEnqSBa0kiRJkqSOZEErSZIkSepI/x+uasB27edd9wAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 1152x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "xf=fft1(x1)/len(x1)\n",
    "freqs = np.linspace(0, int(sampling_rate/2), int(len(x1)/2+1))\n",
    "plt.figure(figsize=(16,4))\n",
    "plt.plot(freqs,2*np.abs(xf),'r--')\n",
    " \n",
    "plt.xlabel(\"Frequency(Hz)\")\n",
    "plt.ylabel(\"Amplitude($m$)\")\n",
    "plt.title(\"Amplitude-Frequency curve\")\n",
    " \n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
